//
//  HRMainTabController.m
//  LoveBee
//
//  Created by wyzc on 16/6/12.
//  Copyright © 2016年 叶落知秋. All rights reserved.
//

#import "HRMainTabController.h"
#import "HRMainNavController.h"
#import "HRHomeViewController.h"
#import "HROderViewController.h"


@interface HRMainTabController ()

@end

@implementation HRMainTabController

+(void)initialize
{
    UITabBarItem *item=[UITabBarItem appearance];
    
    NSDictionary *dict=@{NSForegroundColorAttributeName:HRCOLOR(174, 174, 174),NSFontAttributeName:[UIFont systemFontOfSize:16]};
    
    [item setTitleTextAttributes:dict forState:UIControlStateNormal];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    //创建Home 控制器
    HRHomeViewController *HomeVC=[[HRHomeViewController alloc]init];
    [self setNavController:HomeVC title:@"首页" imageName:@"v2_home" imageName_r:@"v2_home_r"];
    
    //创建Order控制器
    HROderViewController *orderVC=[[HROderViewController alloc]init];
    
    [self setNavController:orderVC title:@"闪送超市" imageName:@"v2_order" imageName_r:@"v2_order_r"];
    
    
}

-(void)setNavController:(UIViewController *)controller title:(NSString *)title imageName:(NSString *)imageName imageName_r:(NSString *)imageName_r
{
    //设置控制器为navc的根控制器
    HRMainNavController *NaVC=[[HRMainNavController alloc]initWithRootViewController:controller];
    [self addChildViewController:NaVC];
    //设置控制器名称
    NaVC.tabBarItem.title=title;
    UIImage *normalImage=[UIImage imageNamed:imageName];
    UIImage *selectedImang=[[UIImage imageNamed:imageName_r]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    //设置普通状态下图片
    NaVC.tabBarItem.image=normalImage;
    //设置选中状态下图片
    NaVC.tabBarItem.selectedImage=selectedImang;
    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
